“The time is right for electric cars - in fact the time is critical.” - Carlos Ghosn
Everyday global warming is becoming a more imposing threat. The greenhouse effect caused by the release of carbon dioxide from the process of burning fossil fuels has become perhaps the single greatest challenge humanity has faced. In order to slow and reverse the negative effects of global warming, we need to aggressively pursue technologies and products that will eliminate or greatly reduce the amount of fossil fuel burned and as a result the amount of CO2 added to the atmosphere. The transportation sector accounted for roughly 26 percent of the greenhouse gas emissions in the U.S. in 2014, the second largest contributing sector.1 Electric cars provide a great opportunity to help reduce and eventually eliminate the greenhouse gas contributions of over a quarter of the total U.S. greenhouse gas emission sources.
The catch, of course, is that eliminating the need to burn fossil fuels in the transportation sector shifts the energy burden to the electricity sector, the largest contributing sector to greenhouse gas emissions in the U.S. comprising 30 percent of all emissions.1 This fact has served as fodder for some to criticize the greenhouse gas reducing possibilities of electric vehicles. “Electric cars are coal-powered cars. Their carbon emissions can be worse than gasoline powered cars.” -Vinod Khosla. To say that electric vehicles are completely emission-free is, in most case, incorrect, or at least doesn’t consider the full story. And this quote about the emissions from electric cars being worse than gasoline cars may certainly be true in some cases. In this analysis I will explore this claim and show under what conditions it may prove true.
The 2015 Paris Agreement called for an aggressive reduction in global carbon emissions and two of the sectors most responsible for emitting CO2 are the electricity and transportation sectors. It is important to understand that while electric cars can do a great deal with respect to reducing carbon emissions in the transportation sector, the net impact is not as simple. While our electricity system is still reliant on fossil fuels, any emissions impact from the transition to electric vehicles will be mitigated by the fact that additional electricity will need to be generated to charge those batteries.
Standing in line for the Tesla Model 3 last month, I became one of the over 300,000 people to reserve the company’s first “mass-market” long range electric vehicles in the first week of reservations. As electric cars prepare to play a larger role in the market, it is important to understand how commodity prices and the electricity system in the US will interact with the demand for and viability of electric vehicles.
I have worked professionally in energy and electricity market consulting for the past five years and have developed an understanding of how the various pieces of the electricity system fit together. This experience will help me contextualize my data and analysis. In addition to my professional work, I am environmentally conscious and passionate about technology and “green innovations”. I hope that through this analysis I will present information that will encourage others to make the switch from traditional gasoline engine vehicles to electric vehicles.
This analysis will explore two key concepts surrounding the discussion of electric vehicles in comparison with traditional internal combustion engine (ICE) vehicles. The first concept I will explore is relative cost to operate. At this point, the sticker price for electric vehicles tends to be higher on average than their most comparable ICE vehicle counterpart. This upfront cost comparison, however, ignores the costs of operating the car, which as I will see skews sharply in favor of electric vehicles. I can create such a comparison by evaluating the average cost to drive each type of vehicle a mile.
The second concept I will explore is the CO2 emissions per mile of both types of vehicle. While we often think the answer to this is obvious that EVs do not emit any CO2, the reality is that there are CO2 emissions related to the production of the electricity used to charge the batteries in these vehicles. I will show how the CO2 intensity of various types of electricity generating units (EGUs) compare to the tailpipe emissions of traditional ICE vehicles.
This section will discuss the sources of data used for this analysis as well as the methods used for wrangling and preparing the data for the analysis. In addition to the data details described, explanations for specific methodologies will be provided through out the analysis to clarify decisions and processes as necessary.
In an effort to make this analysis as reproducible as possible, all sources of data used here are publicly available.
Throughout the analysis, we rely heavily on the website FuelEconomy.gov, which is the official U.S. government source for fuel economy information. This website is provided under the U.S. Department of Energy. Specifically we rely on the information provided in the “Vehicle” data set which contains information for 1984-current model year vehicles. This data set contains information central to the analysis such as the efficiency of all vehicles, as measured in miles per gallon (mpg) for internal combustion engine vehicles (ICE) and in killowatthours per 100 miles for electric vehicles. This data set also contains information on the amount of carbon dioxide emitted at the tailpipe for ICE vehicles.
In addition to the U.S. DOE vehicles data set, we rely on the U.S. Energy Information Administration for data on average annual U.S. retail electricity prices and the carbon dioxide intensity of various electricity generating unit fuel types. This information is used to calculate the carbon dioxide equivalent emissions of driving an electric vehicle. Unfortunately, some data that would be quite interesting, useful and relevant for this analysis is not publicly available. For example, data and statistics on car sales by make and model are generally not available publicly and only for purchase. In the spirit of performing a reproducible analysis, it seems appropriate to exclude such data source even though it precludes me from performing certain analyses that I had hoped to perform and mentioned in my project proposal; notably, the regression analysis. I will instead discuss this issue conceptually in the “Additional Considerations” section.
Throughout my data collection, I encountered data of interest in a variety of formats. This fact required a variety of data wrangling methodologies. In order to provide a readable and complete methodology for gathering my data, I made every effort to codify my data collection.
In the case of my main data set, the “vehicles” data from the U.S. DOE, the data is available for download as a zipped comma-separated values file. For this case, I was able to directly download the zipped data file into a temporary file, unzip the file and read the file in as a table using the readr library.
The data from the U.S. EIA that provided values for the carbon dioxide intensity of the various electric generating unit fuel types was contained in an html table on the website of the EIA. I used a web scraping technique to pull the table directly into my R work space by finding the xpath of the data table in the html code and using the rvest library to read in the table.
Some of the data from the EIA was available as downloadable Microsoft excel files. The data sources in this form included the average annual historical U.S. retail electricity prices and the average annual historical U.S. gasoline prices. In most cases, these excel files did not not begin in the first column and row. Instead, I needed to specify what row was the “startRow” using the functionality provided in the xlsx library. I then used the dplyr library to clean the data down to what was most important and remove any NA columns that had been read in. Note that the form of these downloads did not allow for direct download into the work space.
As discussed in the data sources section, I begin the analysis by downloading our main data set from the U.S. Department of Energy on fuel economy for all vehicles and reading the set into my work space.
# Open and Unzip Data From U.S. Department of Energy
temp <- tempfile()
download.file("http://www.fueleconomy.gov/feg/epadata/vehicles.csv.zip", temp, mode="wb")
unzip(temp, "vehicles.csv")
vehicles <- read.table("vehicles.csv", sep=",", header=T)
# **NOTE** Another data set giving grade to vehicles on emissions was also available and initially potentially useful. As I explored the data further, I decided a more robust analysis would be to measure and compare the environmental impacts of vehicles pased on the amount of carbon dioxide released rather than the grades provided in the `emissions` data set here.
# download.file("http://www.fueleconomy.gov/feg/epadata/emissions.csv.zip", temp, mode="wb")
# unzip(temp, "emissions.csv")
# emissions <- read.table("emissions.csv", sep=",", header=T)
# #
# # Merge Vehicle and Emission Data Sets
# merged <- vehicles %>%
# left_join(emissions, by = "id")
Now that I have loaded the vehicles data set into my work space, it is worth exploring a bit to understand the information available and what potential variables I will use throughout the remainder of this analysis. A few examples of the exploratory data I have reviewed include comparing the City and Highway efficiencies of vehicles, comparing total types of cars by vehicle class and total types by fuel type.
# Explore Vehicles
# Car Efficiency Highway vs. City
p <- vehicles %>%
ggplot(aes(x=year)) +
geom_point(aes(y=UCity, color="City MPG")) +
geom_point(aes(y=UHighway, color="Highway MPG"))+
xlab("Year") +
ylab("Miles Per Gallon") +
ggtitle("Highway vs. City Vehicle Efficiencies")
ggplotly(p)
# Vehicle Class
qplot(year, data=vehicles, geom="bar", fill=factor(VClass))
p <- vehicles %>%
ggplot(aes(x=year, fill=VClass)) +
geom_bar(stat="bin", position="stack") +
xlab("Year") +
ylab("Frequency") +
ggtitle("Vehicle Class Frequency")
ggplotly(p)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# Fuel Type
p <- vehicles %>%
ggplot(aes(x=year, fill=fuelType )) +
geom_bar(stat="bin", position="stack") +
xlab("Year") +
ylab("Frequency") +
ggtitle("Vehicle Frequency by Fuel Type")
ggplotly(p)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Other data that I explored as potentially useful was historical energy prices by state. It would be interesting to perform a similar analysis to the final analysis performed in this project on a state-by-state basis. During the course of this analysis, I was unable to find publicly available state-level information for the other pieces that would be necessary to complete this analysis. In any case, I explored the data I gathered from the U.S. EIA on energy prices across the country.
# Download Electricity Price Data
state_elec_price_historical <- read_csv("Average_retail_price_of_electricity.csv", skip=5)
names(state_elec_price_historical)[1] <- "State"
state_elec_price_historical <- melt(as.data.frame(state_elec_price_historical))
## Using State as id variables
state_elec_price_historical$State <- gsub("US-", "", state_elec_price_historical$State)
#Plot Prices
p <- state_elec_price_historical %>%
ggplot(aes(x=variable, y=value, color=State)) +
geom_point() +
xlab("Year") +
ylab("Electricity Price") +
ggtitle("Electricity Price by U.S. State")
ggplotly(p)
The electricity price data I used throughout this analysis is the U.S. average retail price of electricity also provided by the U.S. EIA. For the comparative analysis I have also used the historical national average for gasoline prices. As discussed above in the data and methodologies sections, these files had to be downloaded outside of the model.
us_elec_price_historical <- read_csv("Average_retail_price_of_electricity_annual.csv", skip=4)
names(us_elec_price_historical)[2] <- "centsPerKWh"
# Download Gasoline Price Data
us_gas_price_historical <- read.xlsx("fotw#915_web.xlsx", sheetIndex = 1, startRow = 7)
us_gas_price_historical <- us_gas_price_historical %>%
select(Year, Retail.Gasoline.Price...Current.dollars.gallon.) %>%
filter(Retail.Gasoline.Price...Current.dollars.gallon. > 0)
names(us_gas_price_historical) <- c("Year", "Price")
After loading in the various data sets and exploring the data, I turned to addressing the two central questions of this analysis: how do EVs compare to ICE vehicles on a cost per mile and an emissions per mile basis.
One way to compare the cost benefits of electric vehicles against ICE vehicles is by estimating the cost to drive a mile in each. For this, we rely on data from the U.S. Department of Energy and their fuel economy data set. This data set provides us with the efficiency of cars in terms of miles per gallon (mpg) for ICE vehicles and killowatthours (kWh) per 100 miles driven. For estimates of costs of the fuels for each, we need a monetary value for a gallon of gasoline as well as for the cost of a kWh of electricity. We rely on the U.S. Department of Energy Vehicle Technology Office for average historical prices of gasoline in the United States. For estimates of average historical prices of electricity in the United States, we use data from the U.S. Energy Information Administration (EIA).
In order to calculate the cost per mile for ICE vehicles we will need to use information on vehicle efficiency as measured by mpg and the cost of the inputs, gasoline in this case. Our formula will then be: \[\frac{\frac{$}{gallon}}{\frac{miles}{gallon}}\]
The above equation become: \[\frac{$}{gallon} x \frac{gallon}{miles} = \frac{$}{miles}\]
Let’s first look at historical gas prices in the U.S. since 1980.
## Internal Combustion Engines
# Dollars Per Gallon ($/gal)
dol_gal <- as.data.frame(us_gas_price_historical)
dol_gal$Year <- as.numeric(levels(dol_gal$Year)[dol_gal$Year])
p <- dol_gal %>%
filter(Year >= 1980) %>%
ggplot(aes(Year, Price)) +
geom_line(color="brown") +
ylab("Dollars per Gallon") +
ggtitle("U.S. Average Historical Price per Gallon of Gasoline")
ggplotly(p)
The chart above shows that gasoline prices were relatively low through the 1980s and 90s and began to climb in the early 2000s until peaking in 2012. Since 2012 prices have been on a decline.
Now let’s turn to the efficiency of all ICE vehicles as measured in miles per gallon (mpg) as the data is available in our vehicles data set, excluding electric cars.
# Miles Per Gallon (MPG)
mpg <- vehicles %>%
filter(combE == 0)
p <- mpg %>%
ggplot(aes(year, comb08)) +
geom_point() +
geom_smooth(color="brown") +
xlab("Year") +
ylab("Miles per Gallon") +
ggtitle("Miles per Gallon of All Models")
ggplotly(p)
We can see that efficiency for all ICE vehicles has increased slightly over the most recent 5 years or so after remaining relatively steady for most of the previous 20 years.
# Dollars per Mile
ice_merged <- mpg %>%
left_join(dol_gal, by=c("year" = "Year")) %>%
mutate(CentsPerMile = Price*100/comb08)
p <- ice_merged %>%
ggplot(aes(year, CentsPerMile)) +
geom_point() +
geom_smooth(color="brown") +
xlab("Year") +
ylab("Cents per Mile") +
ggtitle("Internal Combustion Engine Cost per Mile (Cents per Mile)")
ggplotly(p)
We can see in the chart that the gas prices have an obvious impact on the cost to drive an ICE vehicle particularly in the 2000s even though this time period coincides with an increased efficiency in ICE vehicles. That increased efficiency effect can be seen in the graph as the cost impact of driving a mile is not as drastic as the graph of the gasoline prices.
I now repeat the ICE vehicle analysis with electric vehicles. In this section the equation become for cost per mile becomes: \[\frac{$}{kWh} x \frac{kWh}{mile} = \frac{$}{mile}\]
First, lets look at how average retail electricity prices in the U.S. have changed over the last decade.
## Electric Vehicles
# Dollars Per Killowatthour ($/kwh)
dol_kwh <- us_elec_price_historical
# Augment Data for 2016
price_2016 <- us_elec_price_historical %>%
filter(Year >= 2014) %>%
summarise(centsPerKWh =mean(centsPerKWh))
dat_2016 <- as.data.frame(c(2016, price_2016))
names(dat_2016) <- names(dol_kwh)
dol_kwh <- us_elec_price_historical %>%
rbind(dat_2016)
p <- dol_kwh %>%
ggplot(aes(Year, centsPerKWh)) +
geom_line(color="blue") +
ylab("Cents per kWh") +
ggtitle("Average Annual U.S. Electricity Prices")
ggplotly(p)
The chart above shows a generally constant increase in electricity prices over the period increasing from less than eight cents per kWh to more than 10 cents per kWh.
Now let’s turn to the data available in the vehicles data set. The data set has information on the efficiency of electric vehicles measured as kWh/100 miles, which can be converted into the second variable in our equation; \(\frac{kWh}{mile}\).
# Killowatthour/100 miles (kwh/100m)
kwh_100m <- vehicles %>%
filter(combE > 0)
p <- kwh_100m %>%
ggplot(aes(year, combE)) +
geom_point() +
geom_smooth() +
xlab("Year") +
ylab("kWh per 100 Miles") +
ggtitle("Electric Vehicle Killowatthours per 100 Miles")
ggplotly(p)
We can see in the graph above that overtime, the efficiency of electric vehicles has improved considerably.
Now I use these estimates to calculate the cost per mile for electric vehicles.
# Dollars per mile
elec_merged <- kwh_100m %>%
left_join(dol_kwh, by=c("year" = "Year")) %>%
mutate(centsPerMile = (combE/100)*centsPerKWh)
p <- elec_merged %>%
ggplot(aes(year, centsPerMile)) +
geom_point() +
geom_smooth() +
xlab("Year") +
ylab("Cents Per Mile") +
ggtitle("Cost per Mile for Electric Vehicles")
ggplotly(p)
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
## Warning: Removed 16 rows containing non-finite values (stat_smooth).
Combining the cost of electricity with the efficiency of electric vehicles shows a relatively stable cost per mile for EVs with the increasing cost of electricity somewhat offsetting the gains in efficiency.
Now I bring the estimates of cost per mile for electric vehicles and ICE vehicles together to compare the cost per mile against each other.
p <- ggplot() +
geom_smooth(aes(elec_merged$year, elec_merged$centsPerMile, color="Electric")) +
geom_smooth(aes(ice_merged$year,ice_merged$CentsPerMile, color="ICE")) +
scale_color_manual("",
breaks = c("Electric", "ICE"),
values = c("blue", "brown")) +
xlab("Year") +
ylab("Cents per Mile") +
ggtitle("Comparison of Electric and ICE Cars by Cost per Mile")
ggplotly(p)
As we can see, on a purely cost per mile basis, the electric vehicles win out, particularly in the most recent years. However, the trend we notices is that the relative value of an electric vehicle on a per mile basis is largely dependent on gas prices. Should gas prices return to their 1990s era levels, the relative benefit of EVs per mile is much less consequential.
Now, the fleet of electric car options available is not as wide as those for ICE vehicles. We will limit out data set in two ways; one where we include only the vehicle classes where there is an EV option and another where we include only the vehicle classes for which there are more than 10 EV options.
# Create Unique List of VClasses for EVs
elec_type <- elec_merged %>%
select(VClass) %>%
group_by(VClass) %>%
summarize(Count = n())
elec_type
## Source: local data frame [15 x 2]
##
## VClass Count
## (fctr) (int)
## 1 Compact Cars 19
## 2 Large Cars 28
## 3 Midsize Cars 24
## 4 Midsize Station Wagons 1
## 5 Minicompact Cars 6
## 6 Minivan - 2WD 2
## 7 Small Pickup Trucks 2WD 2
## 8 Small Sport Utility Vehicle 2WD 5
## 9 Small Station Wagons 4
## 10 Special Purpose Vehicle 2WD 2
## 11 Sport Utility Vehicle - 2WD 8
## 12 Standard Pickup Trucks 2WD 5
## 13 Standard Sport Utility Vehicle 4WD 6
## 14 Subcompact Cars 25
## 15 Two Seaters 17
trim_elec_type <- elec_type %>%
filter(Count > 10)
trim_elec_type
## Source: local data frame [5 x 2]
##
## VClass Count
## (fctr) (int)
## 1 Compact Cars 19
## 2 Large Cars 28
## 3 Midsize Cars 24
## 4 Subcompact Cars 25
## 5 Two Seaters 17
elec_merged_trim <- elec_merged %>%
filter(VClass %in% trim_elec_type$VClass)
# Trim the ICE data to only include comparable cars
ice_comparable <- ice_merged %>%
filter(VClass %in% elec_type$VClass)
ice_comparable_trim <- ice_merged %>%
filter(VClass %in% trim_elec_type$VClass)
Let’s look at how the more comparable sets of ICE vehicle classes stack up with respect to cost per mile.
# Cost per Mile for Groups of ICE Vehicles
p <- ggplot() +
geom_smooth(aes(ice_merged$year, ice_merged$CentsPerMile, color="All Classes")) +
geom_smooth(aes(ice_comparable$year, ice_comparable$CentsPerMile, color="Classes with EV Option")) +
geom_smooth(aes(ice_comparable_trim$year, ice_comparable_trim$CentsPerMile, color="Classes with > 10 EV Options")) +
scale_color_manual("",
breaks = c("All Classes", "Classes with EV Option", "Classes with > 10 EV Options"),
values = c("brown", "black", "darkgreen")) +
ylab("Cents per Mile") +
xlab("Year") +
ggtitle("Cost per Mile for Groups of ICE Vehicles")
ggplotly(p)
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 1322 rows containing non-finite values (stat_smooth).
## Warning: Removed 1101 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
As we can see, there is some savings from comparing only the ICE vehicle classes that have an EV equivalent. This is generally due to the types of trucks and heavy duty vehicles that tend to be less fuel efficient and at this point do not have EV counterparts.
Let’s now compare the narrowest group of vehicle classes to present the most conservative comparison between ICE vehicles and EVs.
# Comparison of Electric and ICE Cars by Cost per Mile (Assuming Same Vehicle Class)
p <- ggplot() +
geom_smooth(aes(elec_merged_trim$year, elec_merged_trim$centsPerMile, color="Electric")) +
geom_smooth(aes(ice_comparable_trim$year,ice_comparable_trim$CentsPerMile, color="ICE")) +
scale_color_manual("",
breaks = c("Electric", "ICE"),
values = c("blue", "black")) +
xlab("Year") +
ylab("Cents per Mile") +
ggtitle("Comparison of Electric and ICE Cars by Cost per Mile Comparing Same Vehicle Classes")
ggplotly(p)
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 730 rows containing non-finite values (stat_smooth).
Even when we directly compare vehicle classes, electric vehicles are less costly to operate per mile driven, especially in the period of high gasoline prices as was seen through out the first decade of the century.
Global warming is caused by increased greenhouse gases that allow heat from the sun to permeate to earth, but prevent that heat from escaping when reflected off the earth’s surface. Atmospheric greenhouse gases have increased at alarming rates since the industrial revolution and the scientific community has concluded that we need to drastically cut back on burning fossil fuels; a process which releases carbon dioxide (CO2) a greenhouse gas.
While it may seem obvious that an ICE vehicle emits more CO2 than an electric vehicle, it is a bit more complicated. Since the electricity produced to “fuel” electric vehicles does not always come from renewable sources, there are indeed CO2 emissions related to operating an electric vehicle. In this section, we will compare the tailpipe emissions of CO2 per mile of comparable ICE vehicles and CO2 emissions related to producing the energy required to move an electric vehicle a mile.
There are emissions directly related to the operation of ICE vehicles in that when gasoline is burned to fuel the engine, CO2 is released from the tailpipe. Our data set from the U.S. Department of Energy provides information on tailpipe emissions in grams of CO2 per mile.
# ICE CO2 per mile
p <- ice_comparable_trim %>%
ggplot(aes(year, co2TailpipeGpm)) +
geom_point() +
geom_smooth(color="brown") +
xlab("Year") +
ylab("Grams per Mile") +
ggtitle("CO2 per Mile for Comparable Class ICE Vehicles")
ggplotly(p)
We can see in the chart above that comparable ICE vehicles have remained fairly steady in their emissions per mile driven over the last thirty years. However, we have seem that in the last five years a slight improvement in tailpipe emissions.
Electric vehicles produce no CO2 at the tailpipe. EVs, in fact, do not even have tailpipes. However, CO2 is generally burned in order to create the electricity used to charge the battery in an EV. Here we must scrape the data for CO2 per kWh directly from an html table on the EIA’s website.
# Scrap EIA Table for CO2 per kWh
url <- "https://www.eia.gov/tools/faqs/faq.cfm?id=74&t=11"
co2_kwh <- url %>% read_html() %>% html_node(xpath ='//*[@id="innerX"]/div/div[3]/div[1]/table') %>% html_table()
co2_kwh <- co2_kwh %>%
filter(Fuel != "Coal")
co2_kwh$Fuel <- str_trim(as.character(co2_kwh$Fuel), "l")
# kWh per Mile
elec_merged_trim <- elec_merged_trim %>%
mutate(kwh_m = combE / 100)
# Combine EV data with CO2 per kWh and convert to grams
grams_per_lb <- 453.593 ## Source: Google
elec_merged_trim <- elec_merged_trim %>%
mutate(bit_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[1]*grams_per_lb,
subbit_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[2]*grams_per_lb,
lig_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[3]*grams_per_lb,
ng_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[4]*grams_per_lb,
fo2_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[5]*grams_per_lb,
fo6_co2_m = kwh_m*co2_kwh$`Pounds of CO2 per kWh`[6]*grams_per_lb)
Now that we have the data set of EVs combined with various levels of CO2 intensity for different fuel types, let’s graph the data and see how the fuels compare on an emission standpoint.
# Graph CO2 per Mile for EVs for each
p <- elec_merged_trim %>%
ggplot(aes(x=year)) +
geom_smooth(aes(y=bit_co2_m, color="Bituminous")) +
geom_smooth(aes(y=subbit_co2_m, color="Subbituminous")) +
geom_smooth(aes(y=lig_co2_m, color="Lignite")) +
geom_smooth(aes(y=ng_co2_m, color="Natural Gas")) +
geom_smooth(aes(y=fo2_co2_m, color="Fuel Oil No. 2")) +
geom_smooth(aes(y=fo6_co2_m, color="Fuel Oil No. 6")) +
scale_color_manual("",
breaks = c("Bituminous", "Subbituminous", "Lignite", "Natural Gas", "Fuel Oil No. 2", "Fuel Oil No. 6"),
values = c("brown", "darkgreen", "black", "red", "blue", "orange")) +
ylab("Grams Per Mile") +
xlab("Year") +
ggtitle("CO2 per Mile for EVs by Electricity Source")
ggplotly(p)
First we notice the same general decline over time that reflects the improved efficiency in EVs over time. The next thing we notice are three distinct groupings of fuel types: coal, oil, and natural gas. We see that the three coal types are grouped together as the most CO2 intensive fuel feed-stock for electricity generating units. The coal units are followed by the two types of oil units and lastly by natural gas, which sits much lower than the other fuel types.
Let’s now compare these CO2 intensity trends to the CO2 emissions per mile from ICE vehicles. For simplicity, I have chosen to only present the most carbon intensive electricity source for each of the three groupings described above.
# Comparison of CO2 per Mile
p<- ggplot()+
geom_smooth(aes(x=ice_comparable_trim$year, y=ice_comparable_trim$co2TailpipeGpm, color="ICE Vehicles")) +
geom_smooth(aes(x=elec_merged_trim$year, y=elec_merged_trim$bit_co2_m, color="EV (Bituminous)")) +
geom_smooth(aes(x=elec_merged_trim$year, y=elec_merged_trim$fo2_co2_m, color="EV (FO2)")) +
geom_smooth(aes(x=elec_merged_trim$year, y=elec_merged_trim$ng_co2_m, color="EV (NG)")) +
scale_color_manual("",
breaks = c("ICE Vehicles", "EV (Bituminous)", "EV (FO2)", "EV (NG)"),
values = c("brown", "orange", "blue", "black")) +
xlab("Year") +
ylab("Grams per Mile") +
ggtitle("Comparison of CO2 Emissions per Mile Over Time")
ggplotly(p)
We can see from this graph that the efficiencies gained overtime in the kWh/mile have helped bring the CO2 intensity of a mile of EV driving below that of a mile of ICE vehicle driving.
Since there is no publicly available data on car prices and volumes of sales in the U.S. by make and model, I am unable to perform here the regression analysis I had wanted to perform and stated in my initial project proposal. In lieu of an analysis based on data, I will discuss here in theoretical terms how I would construct such a model and the implications of various assumptions.
Car buyers face a lot of choices when they hit the market for cars and the ultimate determining factors change from customer to customer. Among considerations most central to car buyers is the price of owning the vehicle. In addition to the sticker price, shoppers compare car efficiencies in miles per gallon and brands based on perceptions of reliability which would factor into expectations of maintenance costs.
Over the last decade, many of these key factors affecting car buyers’ decisions have been in flux, particularly in the electric car market. As gasoline prices soared, consumers were excited by the prospect of drastically lower cost per mile offered by electric vehicles and could easily rationalize paying a bit more up-front for long term savings. Additionally, the availability of electric car charging stations has greatly increased in a short time period.
The hypothesis central to the regression analysis is that electric car sales are a function of their price, the price of comparable ICE vehicles, gas prices, availability of charging infrastructure and electricity price.
The regression model for the hypothesis described above may look something like this: \[ EVs Purchased = \alpha + \beta_{1} (EV Price) + \beta_{2} (ICE Price) + \beta_{3} (gas price) + \beta_{4} (electricity price) + \beta_{5} (charging stations)\]
With this model specification, I might expect \(\beta_{1}\) to be negative, \(\beta_{2}\) to be positive, \(\beta_{3}\) to be positive, \(\beta_{4}\) to be negative, and \(\beta_{5}\) to be positive. In other words, high sticker prices for EVs and higher electricity prices would lead to a decreased demand for EVs while increase sticker price for ICE vehicles, increased gas prices, and increased charging options would lead to increased demand for EVs. Without the data, it is difficult to estimate the magnitude of each effect, but it might be reasonable to expect that the sticker price of EVs and ICE vehicles \(\beta_{1}\) and \(\beta_{2}\) would have the largest impact.
Other potential variables that would be interesting to include in the analysis could be the average range of EVs, a dummy variable indicating whether an EV manufacturer has indicated that a longer range version of the car is close - just as Nissan CEO Carlos Ghosn indicated in 2014 which may have lead to lower volume sales in 2015.5
In the absence of actual data to perform the above regression analysis, I will present sample R code to show my thought processes and demonstrate my ability to code these issues in the R language. For knitting purposes, I will comment-out the code.
# # Load the broom library
# library(broom)
#
# # Speficify the regression model
# model <- lm(EVSales ~ EVPrice + ICEPrice + GasPrice + ElecPrice + ChargingStations, dataSet)
#
# # Turns output from the regression model into a useable dataframe
# tidy(model)
#
# # Report the results with confidence intervals for the coefficient values
# tidy(model, conf.int = TRUE)
1 U.S. Environmental Protection Agency (EPA). 2014. Inventory of U.S. Greenhouse Gases and Sinks. https://www3.epa.gov/climatechange/ghgemissions/usinventoryreport.html.
2 DailyFinance. 2013. Pump vs. Plug: Do You Really Save Money Driving an Electric Car? http://www.dailyfinance.com/2013/06/24/gas-vs-electric-cars-cost-comparison/
3 Idaho National Laboratory. Comparing Energy Costs per Mile for Electric and Gasoline-Fueled Vehicles. https://avt.inl.gov/sites/default/files/pdf/fsev/costs.pdf.
4 The New York Times. 2012. How Green Are Electric Cars? Depends on Where You Plug In. http://www.nytimes.com/2012/04/15/automobiles/how-green-are-electric-cars-depends-on-where-you-plug-in.html?_r=0
5 Car and Driver. 2014. Can You BeLeaf It: Nissan Promises 240-Plus-Mile Range for Next Leaf. http://blog.caranddriver.com/can-you-beleaf-it-nissan-promises-240-plus-mile-range-for-next-leaf/